﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Components.SaveFile
{
    public partial class SaveFile : UserControl
    {
        SaveFileDialog sfd = new SaveFileDialog();
        public event EventHandler FileChange;

        public bool AddExtension
        {
            get { return sfd.AddExtension; }
            set { sfd.AddExtension = value; }
        }

        public string Filter
        {
            get { return sfd.Filter; }
            set { sfd.Filter = value; }
        }

        public new string Text
        {
            get { return this.textBox1.Text; }
            set { this.textBox1.Text = value; }
        }

        public SaveFile()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                this.textBox1.Text = sfd.FileName;
                if (FileChange != null)
                    FileChange(this, new EventArgs());
            }
        }
    }
}
